Skip to content

Fix controls disappearing after dragging a window to another monitor - #2

Closed
Qurtison wants to merge 1 commit into
DjaboDev:mainfrom
Qurtison:fix/adopt-window-on-monitor-change
Closed

Qurtison wants to merge 1 commit into
DjaboDev:mainfrom
Qurtison:fix/adopt-window-on-monitor-change

Conversation

@Qurtison

@Qurtison Qurtison commented Oct 6, 2026

Copy link
Copy Markdown

Problem

After dragging a window to another monitor with the top-edge strip (or SUPER + drag), the minimize, maximize and close buttons disappear.

The drag controller moves windows with hl.dsp.window.move({ x, y, relative = false }). That changes the window's position but not the monitor or workspace Hyprland files it under. So once the drag ends, win.monitor still names the old monitor, and winMonitor falls back to it. The old monitor's overlay keeps hosting the controls at coordinates outside its own screen, so they can't be seen.

Reproduced on Hyprland 0.56.2 with two monitors (DP-1 3440×1440 at 0,0 and DP-2 1920×1080 at 3440,0): a floating window moved to x=4000 still reported monitor: DP-1, workspace: 1.

Fix

  • src/lua/mousefirst.lua: new MOUSE_FIRST.adopt(address, x, y, w, h). It finds the monitor under the window's top-center point, using the same logical size calculation as monitor_state. If that differs from the window's current monitor, it moves the window to that monitor's active workspace (follow = true) and re-applies the final size and position, because the workspace move shifts floating windows on its own.
  • src/js/hypr.js: evalAdopt() builder.
  • src/DragController.qml: _finish() calls it after the final move or snap. Both overlay drags and handed-over native drags go through this path.

It does nothing when the window stays on the same monitor.

Testing

  • node --test tests/*.test.mjs: 18/18 pass.
  • Moved a floating window to DP-2 coordinates and called MOUSE_FIRST.adopt. Afterwards Hyprland reported monitor: DP-2, workspace: 2 at the same position, and mousefirst status showed the active window on DP-2.

🤖 Generated with Claude Code

…kspace

The drag controller moves windows with absolute coordinates, which never
changes the monitor or workspace Hyprland files them under. A window
dropped on another monitor kept reporting its old monitor, so the overlay
for that monitor hosted the controls at coordinates outside its screen
and the buttons disappeared.

When a drag finishes, MOUSE_FIRST.adopt now checks which monitor the
window landed on and, if it changed, moves the window to that monitor's
active workspace and re-applies the final geometry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Qurtison

Copy link
Copy Markdown
Author

Closing this one. I've ended up keeping these changes as customizations to my own copy instead of sending them upstream - my setup has grown into a fork with a pile of local tweaks (multi-monitor dragging, resizing a window to the monitor it lands on, tiling on double-click), and I'd rather not keep maintaining those as pull requests against your tree.

Nothing here is wasted if you ever want the fix anyway: the description above covers the problem and the approach, and MOUSE_FIRST.adopt in the Lua module plus the evalAdopt() builder and the _finish() call in DragController.qml are the whole patch. It has been running well for me on Hyprland 0.56.2 with two monitors since I put it in.

Thanks for the plugin - the v0.2 rewrite made all of this possible.

@Qurtison Qurtison closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant